package me.ereach.mapinterface;

import me.ereach.hashtable.User;

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Map<String, User> map = new HashMap<>();

        var u1 = new User("Tom", "male", "e1", 19);
        var u2 = new User("Jerry", "male", "e2", 21);
        var u3 = new User("Cherry", "female", "e3", 16);
        var u4 = new User("Wendy", "female", "e4", 18);

        map.put(u1.getEmail(), u1);
        map.put(u2.getEmail(), u2);
        map.put(u3.getEmail(), u3);
        map.put(u4.getEmail(), u4);

        var u = map.get("e1");
        System.out.println(u);

        var flag = map.containsKey("e3");
        System.out.println(flag);

        map.replace("e1", new User("Tod", "male", "e5", 22));
        System.out.println(map.get("e1"));
    }
}
